{extend name='layout/main' /}

{block name='main'}

<div class="title">{if $Think.cookie.article_id}修改文章{else}添加文章{/if}</div>
<div class="form article_form">
    <form id="Article" action="/api/edit_article" method="post" enctype="multipart/form-data">
        <div class="error"></div>
        <div class="success"></div>
        <div>
            <label>
                <span>标题：</span>
                <span><input type="text" name="title" value="{$article.title}"></span>
            </label>
        </div>
        <div>
            <label>
                <span>标题颜色：</span>
                <span><input type="text" name="title_color" value="{$article.title_color}"></span>
            </label>
        </div>
        <div>
            <label>
                <span>摘要：</span>
                <span>
                    <textarea name="summary">{$article.summary}</textarea>
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>作者：</span>
                <span>
                   <input type="text" name="author" value="{$article.author}">
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>来源：</span>
                <span>
                   <input type="text" name="fromto" value="{$article.fromto}">
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>录入者：</span>
                <span>
                   <input type="text" name="inputer" value="{$article.inputer}">
                </span>
            </label>
        </div>

        <div>
            <label for="#">
                <span>属性：</span>
                <span>
                   <input type="checkbox" name="hot" value="1" {if $article.hot}checked{/if} /> 热门
                   <input type="checkbox" name="top" value="1" {if $article.top}checked{/if} /> 置顶
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>排序：</span>
                <span><input type="text" name="sort" value="{if $article.sort}{$article.sort}{else}50{/if}"></span>
            </label>
        </div>

        <div>
            <label>
                <span>分类：</span>
                <span>
                    <select name="pid">
                        <option value="0">顶级分类</option>
                        {if $tree}
                            {foreach $tree as $it}
                            <option value="{$it.pid}" {if $article.pid eq $it.pid}selected{/if}>{$it.name}</option>
                            {if isset($it.child)}
                                    {foreach $it.child as $sit}
                                    <option value="{$sit.pid}" {if $article.pid eq $sit.pid}selected{/if}>&nbsp;&nbsp;&nbsp;└ {$sit.name}</option>
                            {if isset($sit.child)}
                                            {foreach $sit.child as $tit}
                                            <option value="{$tit.pid}" {if $article.pid eq $tit.pid}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└ {$tit.name}</option>
                            {/foreach}
                                        {/if}
                                    {/foreach}
                                {/if}
                            {/foreach}
                        {/if}
                    </select><br />
                    <tt>最多允许三级分类</tt>
                </span>
            </label>
        </div>

        <div>
            <label for="#">
                <span>缩略图：</span>
                <span>
                    <ul class="upload_thumb">
                        <li id="show-upload-img" {if $article.thumb} {else} style="display: none" {/if}>
                            <img src="{if $article.thumb} {$article.thumb} {/if}" alt="" class="thumb">
                        </li>
                        <li class="upload_input">
                            <input type="file" name="thumb">
                        </li>
                    </ul>
                </span>
            </label>
        </div>


        <div>
            <label>
                <span>正文：</span>
                <span>
                     <script id="editor" name="body" type="text/plain">{$article.body}</script>
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>关键字：</span>
                <span>
                   <input type="text" name="keyword" value="{$article.keyword}">
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>阅读次数：</span>
                <span>
                   <input type="text" name="read_count" value="{$article.read_count}">
                </span>
            </label>
        </div>

        <div>
            <label>
                <span>创建时间：</span>
                <span>
                   <input type="text" name="created_time" value="{$article.created_time}" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                </span>
            </label>
        </div>


        <div>
            <label>
                <span>最后更新：</span>
                <span>
                   <input type="text" name="updated_time" value="{$article.updated_time}" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                </span>
            </label>
        </div>


        <input type="hidden" name="article_id" value="{$Think.cookie.article_id}">
        <div>
            <label for="#">
                <span></span>
                <span><input type="submit" id="submit" value="保存"></span>
            </label>
        </div>
    </form>
</div>


{/block}

{block name='javascript'}
<script src="/ueditor/ueditor.config.js"></script>
<script src="/ueditor/ueditor.all.js"></script>
<script src="/asset/js/article_edit.js"></script>
<script src="/asset/js/lib/laydate/laydate.js"></script>
{/block}